package com.symria.server.dao.common;

import java.util.Date;

import com.symria.framework.dao.util.TemplateDao;
import com.symria.framework.page.Page;
import com.symria.system.statement.Statement;

public class ReportDao extends TemplateDao {
	
	
	
	public void searchAppAd(Date beginDate, Date endDate,String publicId,Integer adId, Page page){
		Statement stms = stmsFactory.createNativeStatement("select r.public_id,r.ad_id,r.created_date,sum(r.show),sum(r.click),sum(r.download),sum(r.installed),sum(r.activate),sum(r.playstart),sum(r.playdone)");
		          stms.append("from report_ad_app_hour r where 1=1 ");
		          stms.appendBetween("and", "r.created_date", beginDate, endDate);
		          stms.append("and", "r.public_id", "=", publicId);
		          stms.append("and", "r.ad_id", "=", adId);
                  stms.addGroupBy(" r.public_id,r.ad_id,r.created_date ");
                  stms.addOrderBy(" r.created_date desc");
		templateDao.search(stms, page);
	}
}
